import requests
from bs4 import BeautifulSoup


'''
智能组菜:
    1.菜品跳转链接
    2.菜品名称
    3.菜品介绍
    4.菜品图片
'''
def groupdishes(work):
    url = "http://so.meishi.cc/?q="+work
    session = requests.session()
    resopnse = session.get(url).text
    soup = BeautifulSoup(resopnse,"html.parser")
    par = soup.find('div',class_='search2015_cpitem_w clearfix')
    par_list = par.find_all('div',class_='search2015_cpitem')
    data = []
    for list in par_list:
        dict = {}
        dict["food_href"] = list.find('a').get('href')
        dict["food_name"] = list.find('a').get('title')
        dict["food_img"] = list.find('img').get('src')
        dict["food_desc"] = list.find('span',class_='des').text
        data.append(dict)
    return data
if __name__ == '__main__':
    groupdishes("牛肉 土豆")
